package ru.alexo.whiskey.events;

import java.io.IOException;
import java.io.OutputStream;

import ru.alexo.whiskey.util.Instrument;

/**
 * event indicates a change of a track instrument.
 * 
 * @author Exaybachay
 */
public class InstrumentChangeEvent implements TrackEvent {

    private Instrument instrument;

    public InstrumentChangeEvent(Instrument instrument) {
	this.instrument = instrument;
    }

    public int serializeToStream(OutputStream dos, int offset) throws IOException {
	dos.write(offset);
	dos.write(0xC0);
	dos.write(instrument.ordinal());

	return 0;
    }

}
